package com.handinglian.ai.system.enums;

public enum LoginPermissionEnum {
    PERMIT(1,"允许"),
    REFUSE(0,"拒绝");

    public static LoginPermissionEnum valueOfOrdinal(Integer ordinal) {
        return ordinal == null || ordinal >= values().length ? null : values()[ordinal];
    }
    public static LoginPermissionEnum valueOfDesc(String desc) {
        for(LoginPermissionEnum loginPermissionEnum : LoginPermissionEnum.values()){
            if(desc.equals(loginPermissionEnum.getDescription())){
                return loginPermissionEnum;
            }
        }
        return null;
    }
    public static LoginPermissionEnum valueOfKey(Integer key){
        for(LoginPermissionEnum loginPermissionEnum : LoginPermissionEnum.values()){
            if(loginPermissionEnum.getKey()==key){
                return loginPermissionEnum;
            }
        }
        return null;
    }
    private final Integer key;
    private final String description;

    LoginPermissionEnum(Integer key, String description) {
        this.key = key;
        this.description = description;
    }

    public Integer getKey() {
        return key;
    }
    public String getDescription() {
        return this.description;
    }
}
